package com.youlai.system.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.system.common.model.Option;
import com.youlai.system.model.entity.SysCourse;
import com.youlai.system.model.form.CourseForm;
import com.youlai.system.model.vo.CoursePageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 故障对象转换器
 */
@Mapper(componentModel = "spring")
public interface CourseConverter {
    Page<CoursePageVO> entity2Page(Page<SysCourse> page);

    SysCourse form2Entity(CourseForm courseForm);

    CourseForm entity2Form(SysCourse entity);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "content")
    })
    Option entity2Option(SysCourse course);


    List<Option> entities2Options(List<SysCourse> courses);
}
